<?php

use yii\helpers\Html;
use yii\grid\GridView;
use yii\helpers\ArrayHelper;
use common\business\EhrHelper;
use common\models\kingdee\BdRelation;

/* @var $this yii\web\View */
/* @var $searchModel common\models\kingdee\PersonFamilySearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = Yii::t('kingdee', 'Person Families');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="person-family-index">

    <h1><?= Html::encode($this->title) ?></h1>
    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

    <p>
        <?= Html::a(Yii::t('kingdee', 'Create Person Family'), ['create'], ['class' => 'btn btn-success']) ?>
    </p>
    <?= GridView::widget([
        'tableOptions' => ['class' => 'table table-condensed table-bordered table-striped table-hover'],
        'pager' => [
//            'class'          => GoPager::className(),
            'nextPageLabel'  => Yii::t('app', 'Next Page'),
            'prevPageLabel'  => Yii::t('app', 'Previous Page'),
            'firstPageLabel' => Yii::t('app', 'First Page'),
            'lastPageLabel'  => Yii::t('app', 'Last Page'),
            'options' => [
                'class' => 'pagination pagination-sm m-t-none m-b-none',
            ],
        ],
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],
//            'FID',
//            'FNAME',
//            'FCREATORID',
//            'FCREATETIME',
//            'FLASTUPDATEUSERID',
            // 'FLASTUPDATETIME',
            [
                'attribute' => 'RELATION',
                'label' => Yii::t('app', 'Relation'),
                'filter' => ArrayHelper::map(BdRelation::find()->all(), 'FNAME_L2', 'FNAME_L2'),
                'contentOptions' => ['style' => 'width: 150px;'],
            ],
//             [
//                 'attribute' => 'FRELATIONID',
////                 'label' => Yii::t('app', 'Frelationid'),
//                 'value' => function ($model) {
//                     return BdRelation::findOne($model['FRELATIONID'])->FNAME_L2;
//                 },
//                 'filter' => ArrayHelper::map(BdRelation::find()->all(), 'FID', 'FNAME_L2'),
//             ],
//             'FRELATIONID',
//            [
//                'attribute' => 'FPOLITICALFACEID',
//                'contentOptions' => ['style' => 'width: 100px;', 'class' => 'text-left'],
//            ],
            [
                'label' => Yii::t('app', 'Birthday'),
                'attribute' => 'FBIRTHDAY',
                'contentOptions' => ['style' => 'width: 150px;'],
            ],
            // 'FWORKUNIT',
            [
                'label' => Yii::t('app', 'Work Unit'),
                'attribute' => 'FWORKUNIT',
                'contentOptions' => ['style' => 'width: 300px;'],
            ],
            // 'FDEGREEID',
            [
                'label' => Yii::t('app', 'Office Phone'),
                'attribute' => 'FOFFICEPHONE',
                'contentOptions' => ['style' => 'width: 150px;'],
            ],
            // 'FHOMEADDRESS_L1',
            // 'FHOMEADDRESS_L2',
            // 'FHOMEADDRESS_L3',
            // 'FHOMEPHONE',
            [
                'label' => Yii::t('app', 'Home Phone'),
                'attribute' => 'FHOMEPHONE',
                'contentOptions' => ['style' => 'width: 150px;'],
            ],
//             'FPERSONID',
            [
                'attribute' => 'PERSONNAME',
                'label'          => Yii::t('app', 'Employee Name'),
                'value'     => function ($model) {
                    return Html::a($model['PERSONNAME'], [
                        '/kingdee/person/view',
                        'id' => $model['FPERSONID'],
                    ],
                        ['target' => '_blank']);
                },
                'contentOptions' => ['style' => 'width: 150px;', 'class' => 'text-left'],
                'format'    => 'raw',
            ],
            // 'FHRORGUNITID',
            // 'FCONTROLUNITID',
//             'FIDCARDNO',
            [
                'label' => Yii::t('app', 'Id Card No'),
                'attribute' => 'FIDCARDNO',
//                'headerOptions'  => ['class' => 'text-right'],
//                'contentOptions' => ['class' => 'text-right'],
                'contentOptions' => ['style' => 'width: 150px;'],
            ],
            // 'FNATIVEPLACE',
            [
                'label' => Yii::t('app', 'Native Place'),
                'attribute' => 'FNATIVEPLACE',
                'contentOptions' => ['style' => 'width: 150px;'],
            ],
            // 'FGRADUATESCHOOL',
            // 'FFOLKID',
            // 'FSPECIALTY',
            // 'FSPECDUTY',
            // 'FREMARK_L1',
            // 'FREMARK_L2',
            // 'FREMARK_L3',
            // 'FZDY1',
            // 'FZDY2',
            // 'FZDY3',
            // 'FZDY4',
            // 'FZDY5',
            // 'FZDY6',
            // 'FZDY7',
            // 'FZDY8',
            // 'FZDY9',
            // 'FZDY10',
            // 'FZDY11',
            // 'FZDY12',
            // 'FZDY13',
            // 'FZDY14',
            // 'FZDY15',
            // 'FREMARK',
            // 'FPERSONELSTATUS',
            // 'FNAME_L1',
//             'FNAME_L2',
            [
                'label' => Yii::t('app', 'Family Person Name'),
                'attribute' => 'FNAME_L2',
//                'headerOptions'  => ['class' => 'text-right'],
//                'contentOptions' => ['class' => 'text-right'],
                'contentOptions' => ['style' => 'width: 150px;'],
            ],
            // 'FNAME_L3',
            // 'FNUMBER',
            // 'FDESCRIPTION_L1',
            // 'FDESCRIPTION_L2',
            // 'FDESCRIPTION_L3',
            // 'FSIMPLENAME',
            // 'CFHKLXID',
            // 'CFMZID',
            // 'CFWHCDID',
            // 'CFYJ',
            // 'CFZC',
            // 'CFZGTZID',
            // 'CFZW',
            [
                'label' => Yii::t('app', 'ZW'),
                'attribute' => 'CFZW',
                'contentOptions' => ['style' => 'width: 150px;'],
            ],
            // 'CFJTZZ',
            // 'CFLXDH',
            // 'CFJJLXR',
            // 'CFCS',
            ['class' => 'yii\grid\ActionColumn'],
        ],
    ]); ?>
</div>
